<?php

declare(strict_types=1);

namespace App\Controller\delivery;
use App\Controller\BaseController;
use App\Model\AppletPlayletRel;
use App\Model\Playlet;
use App\Model\User;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use Hyperf\HttpServer\Annotation\AutoController;
use App\Model\Applet;
use App\Common\Response\SystemCode;
use App\Service\authority\UserService;

#[AutoController]
class DeliveryController  extends BaseController
{
    #[Inject]
    private UserService $userService;
    /**
     * 查看投放
     */
    public function TeamList(RequestInterface $request)
    {

        $userInfo = $this->userService->getUserAppletInfo(2);
        $userData = User::query()->where('roles_ids','like','57')->where('id','!=', $userInfo['id'])->select(['id as value','real_name as label'])->get()->toArray();
        $returnData = [['value' => 'all','label' => '全部投放组员'],
            ['value' => $userInfo['id'],'label' => $userInfo['real_name']],
        ];
        $returnRes = array_merge($returnData,$userData);
        return $this->response(SystemCode::SYSTEM_SUCCESS, '请求成功', $returnRes);
    }

}